<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width,initial-scale=1,maximum-scale=1.0" />
    <title>
    <#if czjroulette.ext2 ?? && czjroulette.ext2 =="1">
                 线上转盘详情
    <#else>
                线下转盘详情
    </#if>
    </title>
    <#include "/view/admin/head.html"/>
    
    <script type="text/javascript" src="${base}/jstool/bootstrap-datetimepicker/js/bootstrap-datetimepicker.js"></script>
    <script type="text/javascript" src="${base}/jstool/bootstrap-datetimepicker/js/locales/bootstrap-datetimepicker.zh-CN.js"></script>
    <link rel="stylesheet" type="text/css" href="${base}/jstool/bootstrap-datetimepicker/css/bootstrap-datetimepicker.min.css" />
    <script type="text/javascript" src="${base}/jstool/bootstrap-datetimepicker/js/bootstrap-datetimepicker.js"></script>
    <script type="text/javascript" src="${base}/jstool/bootstrap-datetimepicker/js/locales/bootstrap-datetimepicker.zh-CN.js"></script>
    <link rel="stylesheet" type="text/css" href="${base}/jstool/bootstrap-datetimepicker/css/bootstrap-datetimepicker.min.css" />
    <script type="text/javascript" src="${base}/jstool/bootstrap-select/js/bootstrap-select.min.js"></script>
    <script type="text/javascript" src="${base}/jstool/bootstrap-select/lang/defaults-zh_CN.min.js"></script>
    <link rel="stylesheet" type="text/css" href="${base}/jstool/bootstrap-select/css/bootstrap-select.min.css" />        

    <style type="text/css">
        .list-path{
            height: 50px;
            line-height: 50px;
            background-color: #9acfea;

        }
        .table-class{
            width:80%;
            text-align: center;
            border:1px solid #afd9ee;
            margin:0 auto;
            margin-top: 50px;
        }
        table th{
            width:20%;
            background-color: #d9edf7;
            text-align: right;
        }
        table td{
            width:20%;
            text-align: left;
        }
        .go-back{
            float:right;
            margin-right: 30px;

        }
    </style>

<script type="text/javascript">
function firstFileImg() {
		//input
		var docObj = document.getElementById("firstFile");
		//img
		var imgObjPreview = document.getElementById("firstImg");
		//div
		var divs = document.getElementById("localImag");
		if (docObj.files && docObj.files[0]) {
			//火狐下，直接设img属性
			imgObjPreview.style.width = '242px';
			imgObjPreview.style.height = '170px';
			//imgObjPreview.src = docObj.files[0].getAsDataURL();
			//火狐7以上版本不能用上面的getAsDataURL()方式获取，需要一下方式
			imgObjPreview.src = window.URL.createObjectURL(docObj.files[0]);
		} else {
			//IE下，使用滤镜
			docObj.select();
			var imgSrc = document.selection.createRange().text;
			var localImagId = document.getElementById("localImag");
			//必须设置初始大小
			localImagId.style.width = "242px";
			localImagId.style.height = "170px";
			//图片异常的捕捉，防止用户修改后缀来伪造图片
			try {
				localImagId.style.filter = "progid:DXImageTransform.Microsoft.AlphaImageLoader(sizingMethod=scale)";
				localImagId.filters.item("DXImageTransform.Microsoft.AlphaImageLoader").src = imgSrc;
			} catch(e) {
				alert("您上传的图片格式不正确，请重新选择!");
				return false;
			}
			
			imgObjPreview.style.display = 'none';
			
			document.selection.empty();
		}
		return true;
	}  

function secondFileImg() {
	//input
	var docObj = document.getElementById("secondFile");
	//img
	var imgObjPreview = document.getElementById("secondImg");
	//div
	var divs = document.getElementById("localImag");
	if (docObj.files && docObj.files[0]) {
		//火狐下，直接设img属性
		imgObjPreview.style.width = '242px';
		imgObjPreview.style.height = '170px';
		//imgObjPreview.src = docObj.files[0].getAsDataURL();
		//火狐7以上版本不能用上面的getAsDataURL()方式获取，需要一下方式
		imgObjPreview.src = window.URL.createObjectURL(docObj.files[0]);
	} else {
		//IE下，使用滤镜
		docObj.select();
		var imgSrc = document.selection.createRange().text;
		var localImagId = document.getElementById("localImag");
		//必须设置初始大小
		localImagId.style.width = "242px";
		localImagId.style.height = "170px";
		//图片异常的捕捉，防止用户修改后缀来伪造图片
		try {
			localImagId.style.filter = "progid:DXImageTransform.Microsoft.AlphaImageLoader(sizingMethod=scale)";
			localImagId.filters.item("DXImageTransform.Microsoft.AlphaImageLoader").src = imgSrc;
		} catch(e) {
			alert("您上传的图片格式不正确，请重新选择!");
			return false;
		}
		
		imgObjPreview.style.display = 'none';
		
		document.selection.empty();
	}
	return true;
}  

function thirdFileImg() {
	//input
	var docObj = document.getElementById("thirdFile");
	//img
	var imgObjPreview = document.getElementById("thirdImg");
	//div
	var divs = document.getElementById("localImag");
	if (docObj.files && docObj.files[0]) {
		//火狐下，直接设img属性
		imgObjPreview.style.width = '242px';
		imgObjPreview.style.height = '170px';
		//imgObjPreview.src = docObj.files[0].getAsDataURL();
		//火狐7以上版本不能用上面的getAsDataURL()方式获取，需要一下方式
		imgObjPreview.src = window.URL.createObjectURL(docObj.files[0]);
	} else {
		//IE下，使用滤镜
		docObj.select();
		var imgSrc = document.selection.createRange().text;
		var localImagId = document.getElementById("localImag");
		//必须设置初始大小
		localImagId.style.width = "242px";
		localImagId.style.height = "170px";
		//图片异常的捕捉，防止用户修改后缀来伪造图片
		try {
			localImagId.style.filter = "progid:DXImageTransform.Microsoft.AlphaImageLoader(sizingMethod=scale)";
			localImagId.filters.item("DXImageTransform.Microsoft.AlphaImageLoader").src = imgSrc;
		} catch(e) {
			alert("您上传的图片格式不正确，请重新选择!");
			return false;
		}
		
		imgObjPreview.style.display = 'none';
		
		document.selection.empty();
	}
	return true;
}  


</script>    
    
</head>
<body>

<div class="list-path" > <span style="margin-left: 50px;"><span class="glyphicon glyphicon-home"></span> 
    <#if czjroulette.ext2 ?? && czjroulette.ext2 =="1">
                 活动编辑
    <#else>
                 活动编辑
    </#if>
     </span></div>
</div>



<div class="table-class">       
      <#if  message?? &&  message =="1" >
        <div class="alert alert-error" style="background-color: write;color: green;">           
           <font size="5"><strong>发布成功</strong></font>
        </div>
     </#if>
      <#if  message?? &&  message =="0" >
        <div class="alert alert-error" style="background-color: write;color: red;">           
           <font size="5"><strong>取消发布</strong></font>
        </div>
     </#if>
      <#if  message?? &&  message =="3" >
        <div class="alert alert-error" style="background-color: write;color: red;">           
           <font size="5"><strong>添加奖品后,才能发布</strong></font>
        </div>
     </#if>     
      <#if  message?? &&  message =="2" >
        <div class="alert alert-error" style="background-color: write;color: green;">           
           <font size="5"><strong>保存成功</strong></font>
        </div>
     </#if>     
      
    <table class="table table-bordered">
        <thead>

        </thead>
        <tbody>
          <form  action="${base}/roulette/czjrouletteActSave.do?rouletteId=${czjroulette.rouletteId!}" method="post" enctype="multipart/form-data"   id="myform" >
               <input  type="hidden" name="ext2" value="${czjroulette.ext2!}"/>
               <tr>
                <th>活动名称：</th>
                <td><input type="text" id="actname" name="actname"value="${czjroulette.actname!}">   </td>                                                
                </td>
                <th>活动开始时间：</th>
                <td> 
                  <input id="starttime" name="starttime" value="<#if (czjroulette.starttime)??>${czjroulette.starttime?string('yyyy-MM-dd')}</#if>" >                                                                       
                </td>
              </tr>
               <tr>
                <th>活动结束时间：</th>
                <td><input type="text" id="endtime" name="endtime"  value="<#if (czjroulette.endtime)??>${czjroulette.endtime?string('yyyy-MM-dd')}</#if>">   </td>                                                
                </td>
                <th>活动地点：</th>
                <td> 
                <input type="text" id="place" name="place"value="${czjroulette.place!}">                                                                       
                </td>
              </tr>
               <tr>
                <th>活动说明：</th>
                <td><input type="text" id="content" name="content"value="${czjroulette.content!}">   </td>                                                
                </td>
                <th>活动类型：</th>
                <td> 
                  <select name="actType">
                    <option value="1"  <#if czjroulette.actType?? && czjroulette.actType == 1 > selected="selected" </#if> >转盘活动</option>
                    <option value="2"  <#if czjroulette.actType?? && czjroulette.actType == 2 > selected="selected" </#if> >二维码活动</option>
                  </select>                                                                    
                </td>
              </tr>                            

              
              
             
                            
                                           
     </form>   

       <tr>
            <td colspan="4" width="100%" style="text-align: center;">

                <a class="btn btn-success  approve-btn btn-approve" href="czjrouletteActList.do">&nbsp;上一步&nbsp;</a>
                <span >&nbsp;</span> 
                <a class="btn btn-success  approve-btn btn-approve" href="javascript:submitVoteOrder()">&nbsp;下一步&nbsp;</a>
                <span >&nbsp;</span>               
            </td>
        </tr>
               
        </tbody>
    </table>

</div>

<script type="text/javascript">

$(function() {
    //初始化
        $('#starttime').datetimepicker(
				{
					language : 'zh-CN',//显示中文
					format : "yyyy-mm-dd",
					autoclose : true,
					todayBtn : true,
					startDate : "<#if (beginTime)??></#if>",
					minuteStep : 10,
					minView: "month"
				});
        $('#endtime').datetimepicker(
				{
					language : 'zh-CN',//显示中文
					format : "yyyy-mm-dd",
					autoclose : true,
					todayBtn : true,
					startDate : "<#if (beginTime)??></#if>",
					minuteStep : 10,
					minView: "month"
				}); 
});



  //提交图片
  function submitVoteOrder(){
	  
	       var actname = $("#actname").val();
	       
	       if(actname==""){
	    	   alert("活动名称不能为空");
	    	   return;
	       }
	       var starttime = $("#starttime").val();
	       
	       if(starttime==""){
	    	   alert("活动开始时间不能为空");
	    	   return;
	       }
	       var endtime = $("#endtime").val();
	       
	       if(endtime==""){
	    	   alert("活动结束时间不能为空");
	    	   return;
	       }
	       var place = $("#place").val();
	       
	       if(place==""){
	    	   alert("活动地点不能为空");
	    	   return;
	       }
	   
	       var content = $("#content").val();
	       
	       if(content==""){
	    	   alert("活动说明不能为空");
	    	   return;
	       }		       
	       
	        	  
	         document.getElementById("myform").submit(); 	  	  	  	  	  	  
	 
  }
    
  
</script>

</body>
</html>